home *** CD-ROM | disk | FTP | other *** search
/ Acorn User: China / Acorn User China CD-ROM (UK) (Disc A) / Acorn User China CD-ROM (UK) (Disc A).bin / DEMON / MISC / AT7TOKA9.ZIP / Demon < prev    next >
Encoding:
Text File  |  1993-04-18  |  3.8 KB  |  185 lines

  1. main ()
  2. {
  3.   integer dial_return=0
  4.   string CSI[2]=$chr(27)+"[",red[5]=CSI+"31m",green[5]=CSI+"32m",yellow[5]=CSI+"33m"
  5.   string blue[5]=CSI+"34m",magenta[5]=CSI+"35m",cyan[5]=CSI+"36m",white[5]=CSI+"37m"
  6.   string bright[4]=CSI+"1m",spaces[34]="                                "
  7.   integer i,centre,status,attempts=0,bdrate=19200
  8.  
  9.   openwindow()
  10.   spool_select(0)
  11.   port_txspeed(bdrate)
  12.   port_rxspeed(bdrate)
  13.  
  14.   modem_initialise()            ; Puts the modem into a known state
  15.   waitfor("OK",200)             ; I'm using a USR HST DS+ faxmodem
  16.  
  17.   $port_wordformat("8N1")
  18.   modem_standard("fastest")     ; HST DS+ could be HST or V32bis
  19.   modem_errorcontrol("V42bis")  ; My modem driver assumes V32bis ATB0
  20.  
  21.   logging_rate("L")
  22.   logging_name("Demon Internet")
  23.  
  24. ; Make sure modem doesn't hang up when DTR drops
  25.  
  26.   type "AT&D0"+cr
  27.   waitfor("OK",200)
  28.  
  29. ; This line didn't work as the modem went into command mode when DTR dropped,
  30. ; and I couldn't get ka9q to put it back on line.
  31.  
  32. ; type "AT&D1S38=15"+cr
  33. ; waitfor("OK",200)
  34.  
  35.   vdu(12)
  36.  
  37. ; Spool some diagnostic information. Needs an open spool-file.
  38.  
  39.   spool_select(1)
  40.   type "ATI4"+cr
  41.   waitfor("OK",500)
  42.   spool_select(0)
  43.  
  44. ; Now get on with it
  45.  
  46.   vdu(12)
  47.   heading("Demon Internet Services")
  48.   repeat
  49.   {
  50.     tab(status,3)
  51.     prints yellow+"081 343 4848,,"
  52.     tab(centre,8)
  53.     spool_select(1)
  54.     dial_return=modem_dial("081 343 4848",1)
  55.  
  56. ;    if(dial_return!=0)
  57. ;    {
  58. ;      tab(status,3)
  59. ;      prints yellow+"081 343 2152"+white
  60. ;      tab(centre,8)
  61. ;      spool_select(1)
  62. ;      dial_return=modem_dial("081 343 2152",1)
  63. ;    }
  64.  
  65.     if(dial_return!=0)
  66.     {
  67.       spool_select(0)
  68.       integer now=time()+3000,secs=30
  69.       tab(status,5)
  70.       if(attempts>4)
  71.       {
  72.         prints red+"Giving up ...  "+white
  73.         endlogon()
  74.         return(0)
  75.       }
  76.       prints "Waiting..... "
  77.       while(time()<now)
  78.       {
  79.        countdown()
  80.       }
  81.       tab(status,5)
  82.       attempts=attempts+1
  83.       prints yellow+"Re-Dialling ("+$str(attempts+1)+")"+white
  84.       tab(centre,8)
  85.       for i=1 to 5
  86.       {
  87.         prints spaces+newline
  88.       }
  89.     }
  90.   }
  91.   until(dial_return==0)
  92.   if(waitfor("login: ",100))
  93.   {
  94.     type cr
  95.     if(waitfor("login: ",2000))
  96.     {
  97.       endlogon()
  98.       return(0)
  99.     }
  100.   }
  101.   pauseshow(250)
  102.   type "yourmc"+cr
  103.  
  104.   if(waitfor("assword:",2000))
  105.   {
  106.     endlogon()
  107.     return(0)
  108.   }
  109.   type "Your_Password"+cr
  110.  
  111.   if(waitfor("otocol: ",2000))
  112.   {
  113.     endlogon()
  114.     return(0)
  115.   }
  116.   type "slip"+cr
  117.  
  118.   if(waitfor("HELLO",2000))
  119.   {
  120.     endlogon()
  121.     return(0)
  122.   }
  123.  
  124. ; Change AT7 config touse pipea
  125.  
  126.   doubleclick("adfs::HD4.$.!Comms.Programs.Internet")
  127.  
  128.   pauseshow(300) ; give the new config time to load
  129.  
  130. ; Then kick off ka9q
  131.  
  132.   oscli("WimpTask adfs::HD4.$.!Comms.Programs.!TCPIP")
  133. }
  134.  
  135. countdown ()
  136. {         
  137.   integer x=xpos(),y=ypos()
  138.    tab(status+13,5)
  139.     if(secs<10)
  140.      {
  141.       prints " "+$str(secs)+" "
  142.      }
  143.      else
  144.      {
  145.       prints $str(secs)+" "
  146.      }
  147.    secs=secs-1
  148.    tab(x,y)
  149.    pauseshow(100)
  150. }
  151.  
  152. heading (string name[30])
  153.   {
  154.    string topline[34]="ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ",botline[34]="ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ"
  155.    string midline[34]="ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ"
  156.    integer width=len(name)
  157. ;   centre=(80-width)/2
  158.    centre=1
  159.    status=centre+10
  160.    tab(centre,0)
  161.    prints bright+red+$left(topline,width+4)
  162.    prints "»"
  163.    tab(centre,1)
  164.    prints "º "
  165.    prints cyan+name+" "
  166.    prints red+" º"
  167.    tab(centre,2)
  168.    prints red+$left(midline,width+4)+"¹"
  169.    tab(centre,3)
  170.    prints "º "+green+"Number: "+yellow+$left(spaces,width+4-10)+red+"º"
  171.    tab(centre,4)
  172.    prints red+$left(midline,width+4)+"¹"
  173.    tab(centre,5)
  174.    prints "º "+green+"STATUS: "+yellow+"Dialling"+$left(spaces,width+4-18)+red+"º"
  175.    tab(centre,6)
  176.    prints $left(botline,width+4)
  177.    prints "¼"+bright+white
  178.    tab(centre,8)
  179. }
  180.  
  181. endlogon ()
  182. {
  183.   modem_disconnect()
  184. }
  185.